<?php
/**
 * Clase que servira para conectar con la base de datos
 */
include_once 'conf.php';
 
class CConexion {
	private $obj_con;
	private $servidor;
	private $usuario;
	private $pass;
	private $db;
	
	
	function __construct() {
		$this -> servidor = SERVIDOR;
		$this -> usuario = USUARIO;
		$this -> pass = PASS;
		$this -> db = DB;	
	}
	
	public function conectar() {
		$this -> obj_con = pg_connect ( "host=" . $this -> servidor. " port=5432 dbname=" .$this -> db. " user=" .$this -> usuario. "  password=" .$this->pass ) or die ("Error de conexion.". pg_last_error());
	}
	
	public function desconectar() {
		$this -> obj_con = pg_close();
	}
}

		


?>